FROM openjdk:17-jdk

RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
    echo "Asia/Shanghai" > /etc/timezone
RUN groupadd --gid 5000 tom \
    && useradd --home-dir /home/tom --create-home --uid 5000 \
        --gid 5000 --shell /bin/sh --skel /dev/null tom
RUN mkdir -p /logs/lc-hello && chmod -R 700 /logs/lc-hello && chown -R tom.tom /logs/lc-hello
USER tom
COPY target/*.jar /home/tom/lc-hello.jar
ENV JAVA_OPTS="-XX:MaxRAMPercentage=85.0 -XX:MinRAMPercentage=50.0 -XX:+HeapDumpOnOutOfMemoryError" JVM="-Xmx1024m -Xms512m"

EXPOSE 80
ENTRYPOINT ["sh","-c","java -Duser.timezone=GMT+08 -Dfile.encoding=UTF-8 -jar $JAVA_OPTS $JVM /home/tom/lc-hello.jar"]